package svc

import (
	"paper-pro/app/chat/jobs/batchinsert/internal/config"
	dialogmodel "paper-pro/app/chat/model/chatdialog"
	msgmodel "paper-pro/app/chat/model/chatmsg"
)

const (
	ChatDbName           = "chat"
	DialogCollectionName = "chat_dialogs"
	MsgCollectionName    = "chat_msgs"
)

type ServiceContext struct {
	Config config.Config

	ChatMsgModel    msgmodel.ChatMsgModel
	ChatDialogModel dialogmodel.ChatDialogModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,

		ChatMsgModel:    msgmodel.NewChatMsgModel(c.MongoDB.Source, ChatDbName, MsgCollectionName),
		ChatDialogModel: dialogmodel.NewChatDialogModel(c.MongoDB.Source, ChatDbName, DialogCollectionName, c.Cache),
	}
}
